home *** CD-ROM | disk | FTP | other *** search
- ; ***************************************
- ; * Affichage d'un objet en 3D filiaire *
- ; * par Thomas LANDSPURG *
- ; * IMPORTANT: *
- ; * this version is for Devpack *
- ; * Need the file datasin *
- ; ***************************************
- task_stop=1 ; if we want to be in singletask mode
-
- NB_POINTS_MAX=100 ; number max of point
- TAILLEY=256
- speed_dep=2
- speed_rot=3
-
- prof=1 ; nb de bitplanes de l'ecran
- ;EXEC
- execbase=4
- openlib=-408
- closelib=-414
- AllocMem=-$c6
- FreeMem=-$d2
- Forbid=-132
- Permit=-138
- MEMF_CLEAR=$10000
- MEMF_CHIP=2
- ;GRAPHICS
- OwnBlitter=-456
- DisOwnBlitter=-462
-
- ; Hardware registers
-
- COPRBASE=$dff000
- DMACONR=2
- BLTADAT=$74
- BLTBDAT=$72
- BLTCDAT=$70
- BLTAFWM=$44
- BLTALWM=$46
- BLTAMOD=$64
- BLTBMOD=$62
- BLTCMOD=$60
- BLTDMOD=$66
- BLTCON0=$40
- BLTCON1=$42
- BLTSIZE=$58
- BLTAPTH=$50
- BLTBPTH=$4c
- BLTCPTH=$48
- BLTDPTH=$54
- COP1LCH=$80
- COPJMP1=$88
- DMACON=$96
- VHPOSR=6
-
- start:
- bsr in_wb
- bsr initlib ; ouvre les librairies
-
- ; ALLOCATION MEMOIRE DE L'ECRAN
-
- move.l execbase,a6
- move.l #taillescr*2,d0 ; taille*2 car double buffering
- move.l #MEMF_CLEAR+MEMF_CHIP,d1
- jsr AllocMem(a6)
- tst.l d0 ; d0 pointe sur la zone memoire
- beq erreur_mem ; si d0=0,l'allocation n'a pas eu lieu
- move.l d0,abitplane0 ; pointeur sur le premier ecran
- move.l d0,bitplane0
- add.l #taillescr,d0
- move.l d0,bbitplane0 ; pointeur sur le deuxieme ecran
-
- ; ALLOCATION MEMOIRE DE LA COPPERLIST
-
- move.l execbase,a6 ;reserve de la memoire pour la coplist
- move.l #taillecop,d0 ; la taille a ete choisie large
- move.l #$10002,d1 ; la coplist doit etre en chip
- jsr AllocMem(a6)
- tst.l d0 ; l'accation a bien eu lieu?
- beq erreur_cop ; non,alors sortie
- move.l d0,coplist ; sauvegarde le pointeur sur la coperlist
-
- ; ALLOCATION MEMOIRE DU BUFFER CONTENANT LES POINTS 2d
-
- move.l execbase,a6 ;reserve de la memoire pour la coplist
- move.l #NB_POINTS_MAX*2,d0 ; la taille a ete choisie large
- move.l #$10000,d1
- jsr AllocMem(a6)
- tst.l d0 ; l'accation a bien eu lieu?
- beq erreur_point ; non,alors sortie
- move.l d0,tabpos ; sauvegarde le pointeur sur le buffer
-
- move.w #$8400,DMACONR+COPRBASE ; autorise les DMA blitter
- move.w #32,DMACON+COPRBASE ; eteint les sprites
- bsr initcop ; initialise la copper list
-
- ; ARRET DU MULTITACHE
-
- ifne task_stop
- move.l graphbase,a6
- jsr OwnBlitter(a6) ; prend le controle du blitter
- move.l execbase,a6
- jsr Forbid(a6) ; arrete le multitache
- move.b #%10000111,$bfd100 ; arrete le drive
- endc
-
- ; APPEL AU PROGRAMME PRINCIPAL
-
- bsr main_pg ; pg principal
- out:
- ; REMISE EN ROUTE DU MULTITACHE
-
- ifne task_stop
- move.l execbase,a6
- jsr Permit(a6) ; remet en marche le multitache
- move.l graphbase(pc),a6
- jsr DisOwnBlitter(a6) ; libere le blitter
- endc
-
- ; RESTAURE LA COPPER LIST
-
- move.l graphbase,a0
- move.l oldcop,$32(a0) ; remet le pointeur de l'ancinne coperlist
- ; move.l $26(a0),COPRBASE+COP1LCH
- move.l execbase,a6
- move.l tabpos,a1 ; pointeur sur la zone memoire qui a ete allouer
- move.l #NB_POINTS_MAX,d0 ; taille de cette zone memoire
- jsr FreeMem(a6) ; desallocation
- erreur_point:
- move.l execbase,a6
- move.l coplist,a1 ; pointeur sur la zone memoire qui a ete allouer
- move.l #taillecop,d0 ; taille de cette zone memoire
- jsr FreeMem(a6) ; desallocation
- erreur_cop:
- move.l execbase,a6
- move.l abitplane0(pc),a1 ; adresse de la zone memoire
- move.l #taillescr*2,d0 ; taille de la zone memoire
- jsr FreeMem(a6) ; desaocation
- erreur_mem:
- bsr freelib ; libere les librairies
-
- move.w #$8020,DMACON+COPRBASE ; autorise les sprites
-
- bsr out_wb
- clr.l d0 ; pour signaler au dos qu'il n y pas d'erreur
- rts
-
- ; WORKBENCH STARTUP CODE
- FindTask=-294
- WaitPort=-384
- GetMsg=-372
- ;Forbid=-132
- ReplyMsg=-378
- in_wb: clr.l WBenchMsg ; workbench startup
- move.l execbase,a6
- sub.l a1,a1
- jsr FindTask(a6)
- move.l d0,a4
- tst.l $ac(a4)
- bne du_cli
- lea $5c(a4),a0
- jsr WaitPort(a6)
- lea $5c(a4),a0
- jsr GetMsg(a6)
- move.l d0,WBenchMsg
- du_cli: rts
- out_wb: tst.l WBenchMsg
- beq pas_work
- move.l execbase,a6
- jsr Forbid(a6)
- move.l WBenchMsg,a1
- jsr ReplyMsg(a6)
- pas_work:moveq #0,d0
- rts
- WBenchMsg:
- dc.l 0
-
- ; ****************
- ; * PG PRINCIPAL *
- ; ****************
- main_pg:
- bsr sync ; attente de la synchro
- bsr switch ; switching de page
- bsr bltclear ; effacement de l'ecran
- bsr initblit ; initialise les registre du blitter pour trace de ligne
- bsr affobj ; affiche l'objet
- bsr tstclav ; test du clavier
- btst #6,$bfe001 ; appui sur le bouuton de la souris?
- bne main_pg ; si non, on continue
- rts
-
- ; ##########################
- ; Affichage d'un objet en 3d
- ; ##########################
- ; Remarque: A4 va par la suite etre utilise comme pointeur
- ; sur l'objet,ne pas le modifier!
- affobj:
- move.w numobj(pc),d7 ; numero d'objet courant
- lsl.w #2,d7 ; mul*4
- lea tabobj(pc),a4 ; table des pointeur sur les objets
- move.l (a4,d7.w),a4 ; a4 pointe sur la structure de l'objet
- bsr tstangle ; test de depassement des angles
- bsr calc_matr ; calcule de la matrice de rotation
- bsr calcul_coord ; calcul des coord 2d de chaque point
- bsr aff_line ; affichage des lignes de l'objet
- rts
-
-
- ; ##############################################
- ; # TEST SI L'ANGLE CONTENU DANS D0 EST VALIDE #
- ; ##############################################
- tst_borne
- tst.w d0 ; l'angle est negatif?
- bpl.s rot1
- add.w #360,d0 ; si oui,on rajoute 360
- rot1: cmp.w #360,d0 ; l'angle est sup a 360
- blt.s rot2
- sub.w #360,d0 ; si ouion soustrait 360
- rot2:
- rts
-
-
- ; ###########################
- ; TEST DE VALIDITE DES ANGLES
- ; ###########################
- tstangle:
- lea vitx_a-objet1(a4),a3 ; pointeur sur la vitesse de rot de l'objet
- bsr.s un_angle ; angle x
- bsr.s un_angle ; angle y
- bsr.s un_angle ; anglez
-
- movem.w vitx1-objet1(a4),d0-d2 ; lecture des vitesses de translation
- add.w d0,posx1-objet1(a4) ; on aditionne ces vitesses au position
- add.w d1,posy1-objet1(a4) ; x y et z de l'objet
- add.w d2,posz1-objet1(a4)
- rts
- ; MISE A JOUR ET TEST D'UN ANGLE
- un_angle:
- move.w (a3),d0 ; recupere la vitesse de rotation
- cmp.w #360,d0 ; la vitesse de rotation ne doit pas
- blt.s pas_dep ; etre superieure a 360 degre par image
- sub.w #360,d0
- pas_dep:
- cmp.w #-360,d0 ; la vitesse est superieure a - 360 deg?
- bgt.s pas_dep2
- add.w #360,d0
- pas_dep2:
- move.w d0,(a3) ; sauve la nouvelle vitesse
- add.w anglex1-vitx_a(a3),d0; on ajoute l'angle de l'objet
- bsr tst_borne ; verifie si l'angle est compri entre 0 et 360
- move.w d0,anglex1-vitx_a(a3); sauvegarde du nouvel angle
- addq #2,a3
- rts
-
-
- ; ####################
- ; #SWITCHING DE PAGE #
- ; ####################
- switch:
- move.l graphbase(pc),a1
- move.l abitplane0(pc),d0 ; d0 et d1 contiennent les
- move.l bbitplane0(pc),d1 ; adresses des deux buffers
- tst.b flagcop ; autre page?
- beq.s next_switch
- exg d1,d0 ; on inverse l'ecran physique et logique
- next_switch:
- move.l d1,bitplane0 ; on sauve l'adresse de l'ecran logique
- move.l coplist,$32(a1)
- move.l p_bitcop,a0 ; ainsi qu celle de l'ecran physique
- bsr initbrush ; met la nouvelle adresse dans la
- ; coperlist
- not.b flagcop ; on indique que les 2 ecrans on ete inverse
- rts
- p_bitcop:dc.l 0
- flagcop:dc.b 0
- even
-
- ; ATTENTE DE LA SYNCHRO
-
- sync: cmp.b #50,VHPOSR+COPRBASE ; attent la 50eme ligne pour
- bne.s sync ; changer d'ecran
- rts
-
- ; PG D'AFFICHAGE DES LIGNES
-
- aff_line:
- move.w nblignes1-objet1(a4),d7 ; nombre de lignes de l'objets
- subq #1,d7
- move.l tabpos(pc),a5 ; table des positions 2D
- move.l descrline1-objet1(a4),a6; table des numeros de points
- ; a relier
- next_aff_line:
- move.w (a6)+,d6 ; numero du point de depart
- asl.w #2,d6 ; un point=4 octets
- movem.w (a5,d6.w),d0/d1 ; coord x et y de depart
- move.w (a6)+,d6 ; numero point d'arrivee
- asl.w #2,d6 ; mul*4
- movem.w (a5,d6.w),d2/d3 ; coord x,y d'arrivee
- bsr drawline ; trace d'une ligne
- dbf d7,next_aff_line ; tant qu'il y a des lignes
- rts
-
- ; ##########################################
- ; # TRANSFORMATION DES COORD 3D EN COORD 2D#
- ; ##########################################
- calcul_coord:
- move.l tabpos(pc),a0 ; table qui conteindra les coord 2D
- move.l descrtabx1-objet1(a4),a1; table des coord 3d
- move.w nbpoints1-objet1(a4),d7 ; nb de points de l'objet
- subq #1,d7
- loop: movem.w (a1)+,d0-d2 ; coord x,y,z du point
-
- lsl.l #3,d0 ; augmente la precision lors de calculs
- lsl.l #3,d1 ; (il y aura plus de chiffres significatifs)
- lsl.l #3,d2
- bsr rot ; rotation du point->coord xr,yr,zr
- bsr calc_coord ; transformation x,y,z en xe,ye
-
- move.w d0,(a0)+ ; sauvegarde de xe
- move.w d1,(a0)+ ; sauvegarde de ye
-
- dbf d7,loop ; tant qu'il y a des points
- rts
-
- ; CALCUL DES COORD ECRANS
- ; en entree d0,d1,d2 -> x,y,z
- ; en sortie xe,ye d0,d1
-
- calc_coord:
-
- add.w distz(pc),d2 ; distance de l'ecran
- beq no_div ; eviter la div par 0
- ext.l d0 ; transformation en mot long
- lsl.l #8,d0 ; mult par 256
- divs d2,d0 ; xe=x*e/(z+d)
- add.w #160,d0 ; centrage sur un ecran de 320 points
- ext.l d1
- lsl.l #8,d1
- divs d2,d1 ; y*e/(z+d)
- neg.w d1
- add.w #TAILLEY/2,d1 ; centrage
- no_div:
- rts
-
- ; ######################
- ; ROTATION DANS L'ESPACE
- ; ######################
-
- ; en entree:d0,d1,d2 doivent contenir les angle alpha,teta et phi
- calc_matr:
- lea tabcos(pc),a3 ; table des cosinus
- lea tabsin(pc),a5 ; table des sinus
- moveq #0,d0
- movem.w anglex1-objet1(a4),d0-d2 ; angles x,y,z
- lsl.w #1,d0 ; c'est une table de mots
- lsl.w #1,d1
- lsl.w #1,d2
-
- move.w (a5,d0.w),cosalpha; sauvegarde des angles
- move.w (a3,d0.w),sinalpha
- move.w (a5,d1.w),costeta
- move.w (a3,d1.w),sinteta
- move.w (a5,d2.w),cosphi
- move.w (a3,d2.w),sinphi
-
- lea matr(pc),a3
- move.w cosalpha(pc),d3
- muls costeta(pc),d3
- asr.l #7,d3
- move.w d3,(a3) ; coef 0,0
-
- move.w sinalpha(pc),d4
- muls cosphi(pc),d4
- neg.l d4
- move.w cosalpha(pc),d6
- muls sinteta(pc),d6
- muls sinphi(pc),d6
- asr.l #7,d6
- add.l d6,d4
- asr.l #7,d4
- move.w d4,2(a3) ; coef 1,0
-
- move.w sinalpha(pc),d5
- muls sinphi(pc),d5
- move.w cosalpha(pc),d6
- muls sinteta(pc),d6
- muls cosphi(pc),d6
- asr.l #7,d6
- add.l d6,d5
- asr.l #7,d5
- move.w d5,4(a3) ; coef 2,0
-
- move.w sinalpha(pc),d3
- muls costeta(pc),d3
- asr.l #7,d3
- move.w d3,1*6(a3) ; coef 0,1
-
- move.w cosalpha(pc),d4
- muls cosphi(pc),d4
- move.w sinalpha(pc),d5
- muls sinteta(pc),d5
- muls sinphi(pc),d5
- asr.l #7,d5
- add.l d5,d4
- asr.l #7,d4
- move.w d4,1*6+2(a3) ; coef 1,1
-
- move.w cosalpha(pc),d5
- muls sinphi(pc),d5
- neg.l d5
- move.w sinalpha(pc),d6
- muls sinteta(pc),d6
- muls cosphi(pc),d6
- asr.l #7,d6
- add.l d6,d5
- asr.l #7,d5
- move.w d5,1*6+4(a3) ; coef 2,1
-
- move.w sinteta(pc),d3
- neg.l d3
- move.w d3,2*6(a3) ; coef 0,2
-
- move.w sinphi(pc),d4
- muls costeta(pc),d4
- asr.l #7,d4
- move.w d4,2*6+2(a3) ; coef 1,2
-
- move.w costeta(pc),d5
- muls cosphi(pc),d5
- asr.l #7,d5
- move.w d5,2*6+4(a3) ; coef 2,2
- rts
-
-
- ;#####################
- ; ROTATION D'UN POINTS
- ;#####################
- ; en entree:d0-d2 =coord 3d avant rotation
- ; en sortie:d0-d2 =coord 3d apres rotation
- rot:
- movem.l a3/d3-d7,-(a7)
- lea matr(pc),a3 ; pointeur sur la matrice de rotation
- bsr calc_col ; calcul de la premiere colonne=x
- add.w posx1-objet1(a4),d3
- move.w d3,-(a7) ; sauve x resultant
- bsr calc_col ; deuxieme colonne=y
- add.w posy1-objet1(a4),d3
- move.w d3,-(a7) ; sauve y resultant
- bsr calc_col ; troisieme colonne=z
- add.w posz1-objet1(a4),d3
- move.w d3,d2 ; z resultant
- move.w (a7)+,d1 ; recupere y
- move.w (a7)+,d0 ; recupere x
- movem.l (a7)+,d3-d7/a3 ; recupere les registres
- rts
- ; porduit matriciel d'une colonne
- calc_col:
- move.w d0,d3
- move.w d1,d4
- move.w d2,d5
- muls (a3)+,d3
- muls (a3)+,d4
- muls (a3)+,d5
- add.l d4,d3
- add.l d5,d3
- asr.l #7,d3
- rts
-
- cosalpha:dc.w 0
- sinalpha:dc.w 0
- costeta:dc.w 0
- sinteta:dc.w 0
- cosphi: dc.w 0
- sinphi: dc.w 0
- ; matrice de la rotation
- matr: dcb.w 3*3
-
- ;======================================
- drawline:
- ; AFFICHAGE LINE
- ;D0,D1 : ABSCISSES (INITALE,FINALE)
- ;D2,D3 : ORDONNEES (INITALE,FINALE)
- ; Voir Hardware Manuel pour + de details
-
- movem.l a5/a0-a2/d4-d7,-(a7)
-
- lea COPRBASE,a5
-
- sub.w d0,d2 ; calcul de deltax
- sub.w d1,d3 ; calcul de deltay
-
- move.b d0,d4
- lsl.w #8,d4
- lsl.w #4,d4
- or.w #%101100000000+$ca,d4
- move.l bitplane0(pc),a0
- lsr.w #3,d0
- and.b #$fe,d0
- mulu #40,d1
- add.l d1,a0
- lea (a0,d0.w),a0 ; a0 = pointeur sur le depart
-
- moveq #0,d0 ;
- tst.w d2 ; deltax<0
- bpl.s df_xp
- eor.b #%011,d0; change de cadrant
- neg.w d2
- df_xp:
- neg.w d3 ; deltay=-deltay
- bpl.s df_yp ; deltay<0
- eor.b #%111,d0
- neg.w d3
- df_yp:
-
- cmp.w d2,d3
- bmi.s df_xg
- move.w d3,d1
- eor.b #%001,d0
- exg d2,d3
- bra.s df_calc
- df_xg: move.w d2,d1
- df_calc:
- bsr waitblit
- move.l a0,BLTCPTH(a5)
- move.l a0,BLTDPTH(a5)
- moveq #0,d6
- move.b ft_octs(pc,d0.w),d6
-
- addq.w #1,d1
- lsl.w #6,d1
- addq #2,d1
- move.w d4,BLTCON0(a5)
-
- move.w d3,d0
-
- lsl.w #1,d0
- sub.w d2,d0
- bge.s df_nosign
- or.w #$40,d6
- df_nosign:
- move.w d6,BLTCON1(a5)
- move.w d0,BLTAPTH+2(a5)
- lsl.w #2,d3
- move.w d3,BLTBMOD(a5)
- sub.w d2,d0
- lsl.w #1,d0
- move.w d0,BLTAMOD(a5)
- move.w d1,BLTSIZE(a5) ; START DRAWING
- movem.l (a7)+,a5/a0-a2/d4-d7
- rts
-
- ft_octs:
- dc.b %0011001,%0000101,%0001101,%0011101
- dc.b %0010101,%0001001,%0000001,%0010001
-
- ; attent que le blitter ait fini
- waitblit:
- btst #14,DMACONR+COPRBASE
- bne waitblit
- rts
-
- ; INITIALISE CERTAINS REGISTRES DU BLITTE POUR LE TRACER DE
- ; LIGNES
-
- initblit: ; initialisation lignes blitter
- bsr waitblit
- lea COPRBASE,a5
- move.w #40*prof,d1
- move.w d1,BLTCMOD(a5) ;bltcmod:largeur ecran
- move.w d1,BLTDMOD(a5) ;bltdmod: " "
- moveq #-1,d0
- move.l d0,BLTAFWM(a5)
- move.l d0,BLTBDAT(a5)
- move.w #-$8000,BLTADAT(a5)
- rts
-
-
- ; EFFACEMENT AU BLITTER D'UN BITMAP
-
- bltclear:
- bsr waitblit
- lea COPRBASE,a5
- move.l bitplane0(pc),a0 ; adresse de la zone a effacer
- move.l a0,BLTDPTH(a5)
- move.w #$01f0,BLTCON0(a5) ; destination activee
- move.w #$0000,BLTCON1(a5) ;
- move.w #0,BLTADAT(a5) ; remplissage de 0
- clr.w BLTDMOD(a5) ; modulo=0
- move.w #TAILLEY,d0 ; nb de lignes a remplir
- lsl.w #6,d0
- or.w #20,d0 ; nombre de mots de chaque ligne
- move.w d0,BLTSIZE(a5) ; depart de l'effacement
- rts
- ; OUVERTURE DES LIBRAIRIES
-
- initlib:
- move.l #grafname,a1 ; nom de la librairie
- move.l execbase,a6 ; pointeur sur la librairie EXEC
- jsr openlib(a6) ; ouverture de la graphics.library
- move.l d0,graphbase ; sauvegarde de la base de la libr.
- rts
-
- ; REFERME LES LIBRAIRIES
-
- freelib:
- move.l graphbase(pc),a1; base de la librairie a fermer
- move.l execbase,a6 ; librairie exec
- jsr closelib(a6) ; fermeture de la librairie
- rts
-
- grafname:dc.b 'graphics.library',0
- even
- graphbase:dcb.l 1
-
-
- ; TESTE LES TOUCHES DU CLAVIER
- tstclav:
- sub.b #1,tempo_clav ; temporisation clavier,pour que
- beq new_car ; mobile n'aille pas trop vite de suite
- rts
- new_car:
- move.b #5,tempo_clav
- move.b $bfec01,d0 ; code de la touche courante
- eor.b #$ff,d0
- ror.b #1,d0
-
- cmp.b #$50,d0
- bne pas_f1
- move.w #0,numobj
- pas_f1:
- cmp.b #$51,d0
- bne pas_f2
- move.w #1,numobj
- pas_f2:
- cmp.b #$1e,d0 ; gestion eloignement
- bne pasz
- subq.w #8,distz
- pasz: cmp.b #$3e,d0
- bne paszp
- addq.w #8,distz
- paszp:
- cmp.b #$57,d0
-
- cmp.b #$4e,d0 ; gestion anglex
- bne pash
- addq.w #1,vitx_a-objet1(a4)
- pash: cmp.b #$4f,d0
- bne pasb
- subq.w #1,vitx_a-objet1(a4)
- pasb:
- cmp.b #$4d,d0 ; gestion angley
- bne pasg
- addq.w #1,vity_a-objet1(a4)
- pasg: cmp.b #$4c,d0
- bne pasd
- subq.w #1,vity_a-objet1(a4)
- pasd:
- cmp.b #$0f,d0 ; gestion anglez
- bne pasrg
- subq.w #1,vitz_a-objet1(a4)
- pasrg: cmp.b #$3c,d0
- bne pasrd
- addq.w #1,vitz_a-objet1(a4)
- pasrd:
- cmp.b #$45,d0
- bne pas_esc
- bsr panic
- clr.w vitx_a-objet1(a4)
- clr.w vity_a-objet1(a4)
- clr.w vitz_a-objet1(a4)
- pas_esc:
-
- move.b last_touche,d1
- move.b d0,last_touche
- cmp.b d0,d1
- beq sortclav
- cmp.b #0,d0
-
- sortclav:
- rts
- last_touche:dc.b 0
- even
- panic:
- clr.w vitx1-objet1(a4)
- clr.w vity1-objet1(a4)
- clr.w vitz1-objet1(a4)
- clr.w posx1-objet1(a4)
- clr.w posy1-objet1(a4)
- clr.w posz1-objet1(a4)
- rts
-
- tempo_clav:dc.b 10
- even
- ; INITIALISATION DE LA COPPER LIST
-
- initcop:
- move.l coplist(pc),a0 ; adresse de la copper list
-
- lea mycop(pc),a1 ; on recopie le debut en chip
- tfrcop: move.l (a1)+,(a0)+
- cmp.l #fincop,a1
- bne tfrcop
-
- move.l a0,p_bitcop ; sauvegarde l'endroit de la coplist
- move.l abitplane0,d0 ; ou on initialise les bitlanes
- bsr initbrush ; on initialise les adrs des bitplanes
-
- lea mycop2(pc),a1 ; recopie de la fin de la coperlist
- tfrcop2:move.l (a1)+,(a0)+
- cmp.l #fincop2,a1
- bne tfrcop2
-
- move.l graphbase,a0
- move.l $32(a0),oldcop ; sauvegarde le pointeur de l'ancienne coplist
- move.l coplist,$32(a0); met le nouveau pointeur
- ; lea COPRBASE,a5
- ; move.l coplist,COP1LCH(a5)
- ; clr.w COPJMP1(a5)
- rts
-
- ; MET DANS LA COPPER LIST LES ADRESSES DES BITPLANES
-
- initbrush: ; d0 contient l'adresse du prem plan
- move.w #$00e0,d1 ; adresses de bitp0h
- bsr metadr
- bsr metadr
- rts
-
- metadr: ; cet ici qu'on le met dans la coplist
- swap d0
- move.w d1,(a0)+
- move.w d0,(a0)+
- addq.w #2,d1
- rts
-
-
- mycop:
- dc.w $1001,$fffe
- dc.w $180,0
- dc.w $182,$fff
- dc.w $130,0,$132,0,$134,0,$136,0
- dc.w $138,0,$13a,0,$13c,0,$13e,0
- dc.w $008e,$2581
- dc.w $0090,$40c1
- dc.w $0092,$0038
- dc.w $0094,$00cc
- dc.w $0100,$1000
- dc.w $102,0
- dc.w $108,(prof-1)*40
- dc.w $10a,(prof-1)*40
- fincop:
- mycop2:
- dc.l $ffddfffe
- dc.l $2401fffe
- dc.l $01000000
- dc.l $fffffffe
- fincop2:
- coplist: dc.l 0
- oldcop: dc.l 0
-
- ;DONNES
-
- bitplane0:dcb.l 1
- abitplane0:dcb.l 1
- bbitplane0:dcb.l 1
-
- tabcos: incbin demos:datasin ; table des sinus et cosinus
- tabsin=tabcos+720
-
- tabpos: dc.l 0 ; pointeur sur la table des position 2D
- numobj: dc.w 0 ; numero de l'obj en cours
- tabobj: dc.l objet1,objet2
-
-
- null: dc.w 0
- ; STRUCTURE DEFINISSANT LE PREMIER OBJET
- objet1:
- nbpoints1:dc.w 20 ; nombre de points
- nblignes1:dc.w 32 ; nombre de lignes
- descrline1:dc.l tabline1; pointeur sur la table des numero de points
- descrtabx1:dc.l itabx1 ; pointeur sur la table des coord 3d de chaque pt
- posx1: dc.w 0 ; position x,y,z de l'objet
- posy1: dc.w 0
- posz1: dc.w 0
- anglex1:dc.w 0 ; valeur des angles de l'objet
- angley1:dc.w 90
- anglez1:dc.w 40
- vitx1: dc.w 0 ; vitesses de translation
- vity1: dc.w 0
- vitz1: dc.w 0
- vitx_a: dc.w 0 ; vitesses de rotation
- vity_a: dc.w 0
- vitz_a: dc.w 0
- ; table des numero de points formant une ligne
- tabline1:
- dc.w 0,1,1,2,2,3,3,0,0,4,1,4,2,4,3,4
- dc.w 5,6,6,7,7,8,8,5,5,9,6,9,7,9,8,9
- dc.w 10,11,11,12,12,13,13,10,10,14,11,14,12,14,13,14
- dc.w 15,16,16,17,17,18,18,15,15,19,16,19,17,19,18,19
- ; table des coord 3d de chaque point
- itabx1:
- dc.w -10,-10,5,-10,10,5,10,10,5,10,-10,5
- dc.w 0,0,15
- dc.w -10,-10,-5,-10,10,-5,10,10,-5,10,-10,-5
- dc.w 0,0,-15
- dc.w -10,-10,-25,-10,10,-25,10,10,-25,10,-10,-25
- dc.w 0,0,-20
- dc.w -10,-10,25,-10,10,25,10,10,25,10,-10,25
- dc.w 0,0,20
-
- objet2:
- nbpoints2:dc.w 8 ; nombre de points
- nblignes2:dc.w 12 ; nombre de lignes
- descrline2:dc.l tabline2; pointeur sur la table des numero de points
- descrtabx2:dc.l itabx2 ; pointeur sur la table des coord 3d de chaque p
- posx2: dc.w 0,0,0
- anglex2:dc.w 0,0,0
- vitx2: dc.w 0,0,0
- vitx_a2: dc.w 0,0,0
- ; table des numero de points formant une ligne
- tabline2:
- dc.w 0,1,1,2,2,3,3,0
- dc.w 4,5,5,6,6,7,7,4
- dc.w 0,4,1,5,2,6,3,7
- ; table des coord 3d de chaque point
- itabx2:
- dc.w -10,-10,-10,-10,10,-10,10,10,-10,10,-10,-10
- dc.w -10,-10,10,-10,10,10,10,10,10,10,-10,10
-
- tailleplan=TAILLEY*40
- taillescr=tailleplan*prof
- taillecop=100
-
- distz:dc.w 600
-
-